import type { ConsultOrderDetailRes } from '@/types/consult'
import type {
  ConsultOrderDetailParams,
  Department,
  PayConsultOrder,
  PreConsultOrder,
  PreConsultOrderRes,
  QuickEntryParams,
} from '@/types/quickEntry'
import type { EvaluateDocParams, SendChatMsgParams } from '@/types/room'
import { request, service } from '@/utils/request'

// 医生认证--查询所有科室-层级
export const getDepartment = () => {
  return request<Department[]>('/dep/all')
}

// 问诊-保存/修改问诊订单
export const saveConsultOrder = (data: QuickEntryParams) => {
  return request<{ id: string }>('/patient/consult/order', 'POST', data)
}
// 上传图片
export const uploadImage = (data: string) => {
  return service.upload('/upload', {
    name: 'file',
    filePath: data,
  })
}
// 问诊-支付页面-计算就诊信息和抵扣信息
// GET
// /patient/consult/order/pre
export const preConsultOrderAPI = (data: PreConsultOrder) => {
  return request<PreConsultOrderRes>('/patient/consult/order/pre', 'GET', data)
}
// 订单-支付接口
// POST
// /patient/consult/pay
export const payConsultOrderAPI = (data: PayConsultOrder) => {
  return request<{ payUrl: string }>('/patient/consult/pay', 'POST', data)
}
/**
 * 问诊-查询订单详情信息-找医生、极速问诊和开药问诊
 * GET
 * /patient/consult/order/detail
 *
 *
 */
export const getConsultOrderDetailAPI = (data: ConsultOrderDetailParams) => {
  return request<ConsultOrderDetailRes>('/patient/consult/order/detail', 'GET', data)
}
// 问诊-订单-评价医生
// POST
// /patient/order/evaluate
export const evaluateDocAPI = (data: EvaluateDocParams) => {
  return request<{ id: string }>('/patient/order/evaluate', 'POST', data)
}
// 聊天-发送对话信息
// POST
// /sendChatMsg
export const sendChatMsgAPI = (data: SendChatMsgParams) => {
  return request('/sendChatMsg', 'POST', data)
}
